package com.qire.manhua.dialog;

import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;

import com.qire.common.support.base.BaseDialog;
import com.qire.manhua.R;
import com.qire.manhua.databinding.DialogConfirmTipsBinding;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;

/**
 * 提示确认框（只有确认按钮的提示风格）：用于通用简单提示内容的需求
 */
public class TipsConfirmDialog extends BaseDialog {

    private final ObservableField<CharSequence> title   = new ObservableField<>("温馨提示");
    private final ObservableField<CharSequence> content = new ObservableField<>("");
    private final ObservableField<CharSequence> btnText = new ObservableField<>("我知道了");

    private final DialogConfirmTipsBinding binding;

    public TipsConfirmDialog(@NonNull Context context){
        super(context, R.style.CustomDialog_Translucent);
        binding = DialogConfirmTipsBinding.inflate(LayoutInflater.from(context), null,false);
        binding.setTipsConfirmDialog(this);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(binding.getRoot());
        setCancelable(false);
    }

    public ObservableField<CharSequence> getTitle() {
        return title;
    }

    public ObservableField<CharSequence> getContent() {
        return content;
    }

    public ObservableField<CharSequence> getBtnText() {
        return btnText;
    }

    public TipsConfirmDialog setDialogTitle(CharSequence title) {
        this.title.set(title);
        return this;
    }
    public TipsConfirmDialog setDialogContent(CharSequence content) {
        this.content.set(content);
        return this;
    }
    public TipsConfirmDialog setDialogBtnText(CharSequence btnText) {
        this.btnText.set(btnText);
        return this;
    }

    public void okBtnOnClick(View view) {
        dismiss();
    }

}
